from fastapi import FastAPI, APIRouter
from typing import Optional

from app.modules.crawler.api.router import get_crawler_router
from app.modules.crawler.config import CrawlerSettings


class CrawlerModule:
    """Module for web scraping functionality."""

    def __init__(self, settings: Optional[CrawlerSettings] = None):
        """Initialize the crawler module.

        Args:
            settings: Configuration settings for the crawler module.
        """
        self.settings = settings or CrawlerSettings()
        self.router = get_crawler_router()

    def register_routes(self, app: FastAPI, prefix: str = "/crawler") -> None:
        """Register module routes with the FastAPI application.

        Args:
            app: The FastAPI application instance.
            prefix: The URL prefix for module routes.
        """
        app.include_router(self.router, prefix=prefix, tags=["crawler"]) 